#ifndef ENCIPHER_H
#define ENCIPHER_H

#include <iostream>
#include <string>
#include <memory>
#include <memory.h>
#include <openssl/sha.h>
#include <openssl/aes.h>
#include <openssl/evp.h>
#include <openssl/err.h>
#include <vector>
#include <iomanip>
class Encipher
{
public:
    static void setAesKey(const std::string& key);
    static void setAesiv(const std::string& iv);
    static bool validate(const std::string& mes,const std::string& sha256value);

    static std::unique_ptr<std::string> sha256EVP(const std::string& input);

    static std::unique_ptr<std::string> aesEncryptEVP(std::string& data);
    //static std::unique_ptr<std::string> aesDecryptEVP(std::string &data);

    static std::unique_ptr<std::string> aesDecryptEVP(std::string& data);
private:
    Encipher();
    static std::string toHex(const unsigned char* data, size_t length);

    static Encipher* encipher;
    static std::string aeskey;
    static std::string aesiv;
};

#endif // ENCIPHER_H
